// /////////////////////////////////////////////////////////////////////////////
//
// Name:            SerializedAttribute.h
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Declaration of the SerializedAttribute class.
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

#ifndef __SERIALIZEDATTRIBUTE_H__
#define __SERIALIZEDATTRIBUTE_H__

// Include files
#include "../dependencies.h"
#include "ReferenceCounted.h"
#include "Serializable.h"


// SerializedAttribute class
class SerializedAttribute : public ReferenceCounted
{
public:

    // Initialisation and deinitialisation
    //! Deconstructor
    virtual ~SerializedAttribute();

    // Public methods
    //! Gets the name of this attribute.
    const std::string& getName() const;
    //! Gets the type of this attribute as a string.
    const std::string& getType() const;

    //! Returns the value of this attribute as an aabbox3df.
    virtual aabbox3df    getAabbox3df()    { return aabbox3df(); };
    //! Returns the value of this attribute as an aabbox3di.
    virtual aabbox3di    getAabbox3di()    { return aabbox3di(); };
    //! Returns the value of this attribute as an bool.
    virtual bool         getBool()         { return false; }
    //! Returns the value of this attribute as a SColor.
    virtual SColor       getColor()        { return SColor(255, 255, 255, 255); };
    //! Returns the value of this attribute as a SColorf.
    virtual SColorf      getColorf()       { return SColorf(1.0f, 1.0f, 1.0f, 1.0f); };
    //! Returns the value of this attribute as a dimension2df.
    virtual dimension2df getDimension2df() { return dimension2df(); };
    //! Returns the value of this attribute as a dimension2di.
    virtual dimension2di getDimension2di() { return dimension2di(); };
    //! Returns the value of this attribute as a float.
    virtual f32          getFloat()        { return 0.0f; };
    //! Returns the value of this attribute as an integer.
    virtual s32          getInt()          { return 0; };
    //! Returns the value of this attribute as a line2df.
    virtual line2df      getLine2df()      { return line2df(); };
    //! Returns the value of this attribute as a line2di.
	virtual line2di      getLine2di()      { return line2di(); };
	//! Returns the value of this attribute as a line3df.
	virtual line3df      getLine3df()      { return line3df(); };
	//! Returns the value of this attribute as a line3di.
	virtual line3di      getLine3di()      { return line3di(); };
	//! Returns the value of this attribute as a Serializable object.
	virtual Serializable* getObject()      { return NULL; }
	//! Returns the value of this attribute as a plane3df.
	virtual plane3df     getPlane3df()     { return plane3df(); };
	//! Returns the value of this attribute as a plane3di.
	virtual plane3di     getPlane3di()     { return plane3di(); };
	//! Returns the value of this attribute as a quaternion.
	virtual quaternion   getQuaternion()   { return quaternion(); };
	//! Returns the value of this attribute as a rect<s32>.
	virtual rect<s32>    getRect()         { return rect<s32>(); };
	//! Returns the value of this attribute as a string.
	virtual std::string  getString()       { return std::string(""); };
	//! Returns the value of this attribute as a wide string.
	virtual stringw      getStringW()      { return stringw( stringc( getString().c_str() ).c_str() ); };
	//! Returns the value of this attribute as a vector2df.
    virtual vector2df    getVector2df()    { return vector2df(); };
    //! Returns the value of this attribute as a vector2di.
    virtual vector2di    getVector2di()    { return vector2di(); };
    //! Returns the value of this attribute as a vector3df.
    virtual vector3df    getVector3df()    { return vector3df(); };
    //! Returns the value of this attribute as a vector3di.
    virtual vector3di    getVector3di()    { return vector3di(); };

    //! Sets the value of this attribute as a aabbox3df.
    virtual void setAabbox3df(const aabbox3df &value) {};
    //! Sets the value of this attribute as a aabbox3di.
    virtual void setAabbox3di(const aabbox3di &value) {};
    //! Sets the value of this attribute as a boolean value.
    virtual void setBool(bool value) {};
    //! Sets the value of this attribute as a SColor object.
    virtual void setColor(const SColor &value) {};
    //! Sets the value of this attribute as a SColorf object.
    virtual void setColorf(const SColorf &value) {};
    //! Sets the value of this attribute as a dimension2df object.
    virtual void setDimension2df(const dimension2df &value) {};
    //! Sets the value of this attribute as a dimension2di object.
    virtual void setDimension2di(const dimension2di &value) {};
    //! Sets the value of this attribute as float value.
    virtual void setFloat(f32 value) {};
    //! Sets the value of this attribute as an integer value.
    virtual void setInt(s32 value) {};
    //! Sets the value of this attribute as a line2df object.
    virtual void setLine2df(const line2df &value) {};
    //! Sets the value of this attribute as a line2di object.
    virtual void setLine2di(const line2di &value) {};
    //! Sets the value of this attribute as a line3df object.
    virtual void setLine3df(const line3df &value) {};
    //! Sets the value of this attribute as a line3di object.
    virtual void setLine3di(const line3di &value) {};
    //! Sets the value of this attribute as a Serializable object.
    virtual void setObject(Serializable *object) {};
    //! Sets the value of this attribute as a plane3df object.
    virtual void setPlane3df(const plane3df &value) {};
    //! Sets the value of this attribute as a plane3di object.
    virtual void setPlane3di(const plane3di &value) {};
    //! Sets the value of this attribute as a quaternion object.
    virtual void setQuaternion(const quaternion &value) {};
    //! Sets the value of this attribute as a rect<s32> object.
    virtual void setRect(const rect<s32> &value) {};
    //! Sets the value of this attribute as a string.
    virtual void setString(const std::string &value) {};
    //! Sets the value of this attribute as a wide string.
    virtual void setStringW(const stringw &value) { setString( stringc( value.c_str() ).c_str() ); };
    //! Sets the value of this attribute as a vector2df object.
    virtual void setVector2df(const vector2df &value) {};
    //! Sets the value of this attribute as a vector2di object.
    virtual void setVector2di(const vector2di &value) {};
    //! Sets the value of this attribute as a vector3df object.
    virtual void setVector3df(const vector3df &value) {};
    //! Sets the value of this attribute as a vector3di object.
    virtual void setVector3di(const vector3di &value) {};

protected:

    // Initialisation and deinitialisation
    //! Constructor
    //! @param name          Name of the attribute
    //! @param type          String describing the type of this attribute.
    SerializedAttribute(const std::string &name, const std::string &type);

    // Protected methods
    //! Removes all formatting from the given string in order to extract the base values of the
    //! attribute.
    //! @param value         String that will be examined
    //! @param type          Type to be removed
    std::string removeStringFormatting(const std::string &value, const std::string &type);

private:

    // Private members
    std::string mName;
    std::string mType;
};

#endif
